package com.etiantian.weixin.controller;

import com.etiantian.weixin.model.GradeInfo;
import com.etiantian.weixin.service.GradeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller
public class HelloController {

    @Autowired
    private GradeInfoService gradeInfoService;

	@RequestMapping(value="/",method = RequestMethod.GET)
	public String printWelcome(ModelMap model) {
        List<GradeInfo> list = gradeInfoService.listGradeInfoAll();
		model.addAttribute("message", list.size());
		return "hello";
	}

    @RequestMapping(value="/page",method = RequestMethod.GET)
    public String printPage(ModelMap model) {
        List<GradeInfo> list = gradeInfoService.listGradeInfo(1,5);
        model.addAttribute("message", list);
        return "hello";
    }
}